package cn.com.jinhao.provider.business.controller;

import cn.com.jinhao.hotline.commons.util.RestResponse;
import cn.com.jinhao.provider.business.entity.Wkfl;
import cn.com.jinhao.provider.business.service.WorkflowService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping(value = "/wkfl")
@Api(tags = {"任务流程信息"})
public class WorkflowController {

    @Resource
    WorkflowService workflowService;

    @GetMapping(value = "/wkfl")
    public RestResponse<java.util.Map<String,Object>> queryWkfl(@RequestParam(required = false) String id,@RequestParam(required = false) String evif_code,
        @RequestParam(required = false) String evas_code){
        Wkfl wkfl = new Wkfl();
        wkfl.setId(id);
        wkfl.setBtEvifCode(evif_code);
        wkfl.setBtEvasCode(evas_code);
        Map<String,Object> map = workflowService.select(wkfl);
        return new RestResponse<>(map);
    }
    @PostMapping(value = "/wkfl")
    public RestResponse<java.lang.String> addWkfl(@RequestBody Wkfl wkfl){
        workflowService.insert(wkfl);
        return new RestResponse<>("成功");
    }

    @GetMapping(value = "/queryStatu")
    public RestResponse<java.lang.String> queryStatu(@RequestParam(required = true) String btEvifCode,@RequestParam(required = false) String btEvasCode){
        return new RestResponse<>(workflowService.queryStatu(btEvifCode,btEvasCode));

    }
}
